var commonUtil = require("../../../utils/commonUtil.js")
var globalData = getApp().globalData;
var httpsUrl = globalData.httpsUrl;
var imgUrl = globalData.imgUrl;
Page({

  data: {
    imgUrl: imgUrl,
    list:[],
    info:[],
  },
  onLoad: function (options) {
    let orderInfo = wx.getStorageSync("orderInfo");
    this.setData({ info: orderInfo })
    console.log("orderInfo:" + JSON.stringify(orderInfo));
    var that = this;
    var params = new Object();
    params.orderId = orderInfo.id;
    console.log("params:" + JSON.stringify(params));
    let openId = wx.getStorageSync("openidKey");
    commonUtil.showLoading("加载中...");
    wx.request({
      url: httpsUrl + "/order/goodsList",
      header: { "openId": openId, "content-Type": "application/x-www-form-urlencoded" },
      dataType: "json",
      method: "GET",
      data: params,
      success: function (res) {
        commonUtil.hideLoading();
        res = res.data;
        console.log("res:" + JSON.stringify(res));
        if (res.result == 0) {
          var rows = res.data;
          that.setData({list:rows})
        } else {
          commonUtil.showModal(res.msg);
        }
      }
    })
    console.log("码：http://qr.topscan.com/api.php?text=" + orderInfo.order_no);
  },
})